#!/bin/bash
#check return value
cd source
echo "Compiling Server Java code..."
./compile_server
if [ $? -ne "0" ]; then
    echo "Failed compiling Server Java code"
    exit 1
fi

echo "Compiling Client Java code..."
./compile_client
if [ $? -ne "0" ]; then
    echo "Failed compiling Client Java code"
    exit 1
fi

cp *.jar ../binary
cd ..
echo "Compiling Kernel code..."
cd core
make
if [ $? -ne "0" ]; then
    echo "Failed compiling core"
    exit 1
fi

cp libipt_ipcontext.so ../binary
cp ipt_ipcontext.ko ../binary
make clean
cd ..
echo "Copying logger..."
cd logger
cp daemon.py ../binary
cd ..

